package com.itheima.mapper;

import com.itheima.vo.advVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdvposMapper {
    List<advVO> getPageContent(String advposdesc, String advposname);

    Integer getCount(Integer id);

    List<advVO> getAllList();

    void addAdvpos(advVO adv);

    @Select("select count(*) from ydd_advpos where advposname =#{name}")
    Integer getCountByName(String name);

    /**
     * 行信息advpos
     *
     * @param id id
     * @return {@link advVO}
     */
    @Select("select * from ydd_advpos where id = #{id}")
    advVO rowInfoAdvpos(Integer id);

    @Select("select count(*) from ydd_advpos where advposname = #{advposname} and id != #{id} ")
    Integer getCountByNameAndId(String advposname, Integer id);

    void updateAdvpos(advVO adv);

    @Delete("delete from ydd_advpos where id=#{id}")
    void deleteAdvpos(Integer id);
}
